<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        ul {
            width: 200px;
            height: 200px;
            background-color: lemonchiffon;
        }
        li {
            width: 100px;
            background-color: aqua;
        }

        a {
            display: block;
            width: 100px;
            background-color: sandybrown;
        }
    </style>
</head>
<body>
<ul id="ul">ul
    <li>li<a href="">a</a></li>
    <li>li<a href="">a</a></li>
    <li>li<a href="">a</a></li>
</ul>
<script>
    //事件委托
    var ul = document.getElementById("ul");
    ul.onclick = function(event){
        var tar = event.target; //触发事件的元素
        var tagName = tar.nodeName.toLowerCase();
        var bind = event.currentTarget;  //绑定事件的元素
        var bindName = bind.nodeName.toLowerCase();
        // console.log("你点击了:"+tagName);
        console.log("绑定事件是:"+bindName);
        event.preventDefault();
    }
</script>
</body>
</html>